<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>H+ 后台主题UI框架 - 空白页</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="../favicon.ico">
     <link rel="shortcut icon" href="favicon.ico"> <link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__STATIC__/layout/css/font-awesome.css?v=4.4.0" rel="stylesheet">
     <!-- jqgrid-->
    <link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    
     <link rel="stylesheet" href="__STATIC__/layout/css/channel.css" type="text/css">

    <link href="__STATIC__/layout/css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">
  
    <link rel="stylesheet" href="__STATIC__/layout/css/zTreeStyle.css" type="text/css">
    <style>
      .ren{
    display: inline-block;
    background:#d0e0e0;
    border:1px solid #ccc;
    border-radius:5px;
    margin-right:2px;
    color:#333;
    line-height: 20px;
    height:20px;
    font-size: 12px;
    padding-left:5px;
    padding-right:5px;
}
    </style>
</head>

<body style="color:#333;padding:3px;">
    <!-- 标题 -->
    <div class="page-heade">
      <h1 class="title_color">{$nian}-经销商销售目标报表</h1>
    </div>
    <!-- 标题 -->
    <div class="row-margin-top">
    <form action="#" method="post" id="form_check" class="form-inline">
    <input type="hidden" name="jids" id="jids"/>
      <table class="row-margin-top tab-content table-bordered  table" border="1">
          <tr>
           <td><div class="col-xs-2">经销商</div> <div class="col-xs-8">
                        <div class="input-group" id="" >
                            <input type="text"   placeholder="请输入关键字或空格查询" class="form-control inputremindPeple" id="jxs"  value="">
                           
                            <div class="input-group-btn">
                                <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                </ul>
                            </div>
                        </div>
                    </div></td>
            </tr>
            <tr>
           <td id="selected_jxs">
            {volist name="jxss" id="j"}
              <span class="ren netlist" data-id="{$j.id}">{$j.title}<span class="close">×</span></span>
            {/volist}
           </td>
            </tr>
            <tr>
           <td>&nbsp;&nbsp;品牌：
           <select name="pid" id="pid" class="form-control">
				<option value="0">请选择品牌</option>
				{volist name="brand" id="p"}
        <option value="{$p.id}" {if $p.id==$pid}selected{/if}>{$p.brand_name}</option>
        {/volist}
           </select>
           </td>
            </tr>
                <tr>
           <td>&nbsp;&nbsp;财年：
           <select name="cid" id="cid" class="form-control">
				      {volist name="cainian" id="c"}
                <option value="{$c.id}" {if $cid==$c.id} selected {/if}>{$c.title}</option>
              {/volist} 
           </select>
           </td>
            </tr>
           <tr>
            <td class="text-center">
              <button class="btn btn-info query">查询</button>
              <button class="btn btn-info emptyIf" type="button">清空查询条件</button>
             </td>
            </tr>
      </table>
    
      <table class="table table-bordered text-right bud_hei">
          <tr class="info">
            <th class="text-center">经销商名</th>
            <th class="text-center">品牌</th>
            {volist name="kaohe2" id="k"}
            <th class="text-center">{$k.yue}</th>
            {/volist}
            <th class="text-center">小计(元)</th>
          </tr>
          <tbody>
          {volist name="jarr" id="j"}
            <tr class="text-right">
              <td class="text-left" rowspan="{$j.pc}">{$j.jx}</td>
              <td class="text-left">{$j.pro.0.brand_name}</td>
              {volist name="$j.pro.0.jin" id="jin"}
              <td class="ObjectNum">{$jin}</td>
              {/volist}
              <td class="ObjectNum font-bold">{$j.pro.0.zje}</td>
            </tr>
            {volist name="$j.pro" id="p" offset='1'}
            <tr class="text-right">
              
              <td class="text-left">{$p.brand_name}</td>
               {volist name="$p.jin" id="jin"}
              <td class="ObjectNum">{$jin}</td>
              {/volist}
              <td class="ObjectNum font-bold">{$p.zje}</td>
            </tr>
            {/volist}

            <tr class="warning">
              <td colspan="2" class="font-bold text-center">{$j.jx}</td>
               {volist name="$j.jine" id="jin" key="k"}
              <td class="ObjectNum jisuan{$k}">{$jin}</td>
              {/volist}
              <td class="ObjectNum font-bold jisuanz">{$j.zjine}</td>
            </tr>
          {/volist}
		
          </tbody>
          <tfoot>
            <tr class="trTotal font-bold">
              <td colspan="2" class="text-center">总计：</td>
            {volist name="kaohe2" id="k"}
            <td class="ObjectNum font-bold zonghe{$i}"></td>
            {/volist}
				<td class="ObjectNum font-bold zonghez"></td>
            </tr>
          </tfoot>
      </table>
</form>
    </div>
    <!-- 全局js -->
    <script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
    <script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
    <!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
    <script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
     <script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script>
      <script src="__STATIC__/layout/js/common.js"></script>
      <script src="__STATIC__/layout/js/plugins/suggest/bootstrap-suggest.min.js"></script>
    <script>
      $(document).on("click",".close",function(){
          $(this).parent().remove();
       })
      $(".emptyIf").click(function(){
        location.href="{:url('jxsmubiao')}"
      })
    $(".query").click(function(){
      
      var jarr=[];var i=0;
      $(".ren").each(function(){
        jarr[i]=$(this).attr("data-id");i++;
      })
      var jid=0;
      if(jarr.length>0){
        var jid=jarr.join(',')
      }
      $("#jids").val(jid);
      document.getElementById("form_check").submit();
    })
        //产品网点搜索自动补全
    $("#jxs").bsSuggest({
        url: "{:url('select/myjxsjson')}",
        /*effectiveFields: ["userName", "shortAccount"],
         searchFields: [ "shortAccount"],*/
        effectiveFieldsAlias:{title: "名称"},
        ignorecase: true,
        showHeader: true,
        showBtn: false,     //不显示下拉按钮
        delayUntilKeyup: true, //获取数据的方式为 firstByUrl 时，延迟到有输入/获取到焦点时才请求数据
        idField: "id",
        keyField: "title",
        clearable: true
    }).on('onSetSelectValue', function (e, keyword, data) {
        $(this).val('')
        var bool = false
        $('#selected_jxs .ren').each(function (idx,o) {
            if($(this).data('id') == keyword.id){
                bool = true;
            }
        })
        if(bool == false){
            $('#selected_jxs').append('<span class="ren netlist" data-id="'+keyword.id+'">'+keyword.key+'<span class="close">×</span></span>')
        }
    });
      var zong={$kaohe2c};
      for(var i=1;i<=zong;i++){
        var num=0;
          $(".jisuan"+i).each(function(){
            num+=parseFloat($(this).html())
          })
          $(".zonghe"+i).html(num.toFixed(2))
      }
      var numz=0;
      $(".jisuanz").each(function(){
        numz+=parseFloat($(this).html())
      })
      $(".zonghez").html(numz.toFixed(2))
       $(document).ready(function(){
            var $ObjectNum =$(".ObjectNum");
               toNum($ObjectNum);
             });
          $(".ObjectNum").each(function(){
            $(this).html(parseFloat($(this).html()).toFixed(2))
          })
      
      
    </script>
</body>

</html>
